<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Ram::Packager
  
    &mdash; Jammit
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '..';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (P)</a> &raquo; 
    <span class='title'><span class='object_link'><a href="../Ram.html" title="Ram (module)">Ram</a></span></span>
     &raquo; 
    <span class="title">Packager</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Ram::Packager
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Ram::Packager</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/jammit/packager.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>The Ram::Packager resolves the configuration file into lists of real
assets that get merged into individual asset packages. Given the compiled
contents of an asset package, the Packager knows how to cache that package
with the correct timestamps.</p>

  </div>
</div>
<div class="tags">
  

</div>

  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#force-instance_method" title="#force (instance method)">- (Object) <strong>force</strong> </a>
    

    
  </span>
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Set force to false to allow packages to only be rebuilt when their source
files have changed since the last time their package was built.</p></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#package_names-instance_method" title="#package_names (instance method)">- (Object) <strong>package_names</strong> </a>
    

    
  </span>
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Set force to false to allow packages to only be rebuilt when their source
files have changed since the last time their package was built.</p></div></span>
  
</li>

    
  </ul>




  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#cache-instance_method" title="#cache (instance method)">- (Object) <strong>cache</strong>(package, extension, contents, output_dir, suffix = nil, mtime = nil) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Caches a single prebuilt asset package and gzips it at the highest
compression level.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#cacheable-instance_method" title="#cacheable (instance method)">- (Object) <strong>cacheable</strong>(extension, output_dir) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return a list of all of the packages that should be cached.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#create_packages-instance_method" title="#create_packages (instance method)">- (Object) <strong>create_packages</strong>(config) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Compiles the list of assets that goes into each package.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#glob_files-instance_method" title="#glob_files (instance method)">- (Object) <strong>glob_files</strong>(glob) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Absolute globs are absolute &#8212; relative globs are relative to ASSET_ROOT.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#individual_urls-instance_method" title="#individual_urls (instance method)">- (Object) <strong>individual_urls</strong>(package, extension) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Get the list of individual assets for a package.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Packager) <strong>initialize</strong> </a>
    

    
  </span>
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Creating a new Packager will rebuild the list of assets from the
Ram.configuration.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#latest_mtime-instance_method" title="#latest_mtime (instance method)">- (Object) <strong>latest_mtime</strong>(paths) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Get the latest mtime of a list of files (plus the config path).</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#not_found-instance_method" title="#not_found (instance method)">- (Object) <strong>not_found</strong>(package, extension) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Raise a PackageNotFound exception for missing packages&#8230;</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#pack_javascripts-instance_method" title="#pack_javascripts (instance method)">- (Object) <strong>pack_javascripts</strong>(package) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return the compressed contents of a javascript package.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#pack_stylesheets-instance_method" title="#pack_stylesheets (instance method)">- (Object) <strong>pack_stylesheets</strong>(package, variant = nil, asset_url = nil) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return the compressed contents of a stylesheet package.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#pack_templates-instance_method" title="#pack_templates (instance method)">- (Object) <strong>pack_templates</strong>(package) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return the compiled contents of a <span class="caps">JST</span> package.</p></div></span>
  
</li>

      
        <li class="private ">
  <span class="summary_signature">
    
      <a href="#package_for-instance_method" title="#package_for (instance method)">- (Object) <strong>package_for</strong>(package, extension) </a>
    

    
  </span>
  
  
  <span class="note title private">private</span>
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Look up a package asset list by name, raising an exception if the
package has gone missing.</p></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#precache_all-instance_method" title="#precache_all (instance method)">- (Object) <strong>precache_all</strong>(output_dir = nil, base_url = nil) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Ask the packager to precache all defined assets, along with their gzip&#8217;d
versions.</p></div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <p class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Ram::Packager (class)">Packager</a></span></tt>) <strong>initialize</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Creating a new Packager will rebuild the list of assets from the
Ram.configuration. When assets.yml is being changed on the fly,
create a new Packager.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 17</span>

<span class='kw'>def</span> <span class='id initialize'>initialize</span>
  <span class='comment'># In Rails, the difference between a path and an asset URL is &quot;public&quot;.
</span>  <span class='ivar'>@path_diff</span>   <span class='op'>=</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id public_root'>public_root</span><span class='period'>.</span><span class='id sub'>sub</span><span class='lparen'>(</span><span class='const'>ASSET_ROOT</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
  <span class='ivar'>@path_to_url</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A</span><span class='embexpr_beg'>#{</span><span class='const'>Regexp</span><span class='period'>.</span><span class='id escape'>escape</span><span class='lparen'>(</span><span class='const'>ASSET_ROOT</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>(\/?</span><span class='embexpr_beg'>#{</span><span class='const'>Regexp</span><span class='period'>.</span><span class='id escape'>escape</span><span class='lparen'>(</span><span class='ivar'>@path_diff</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>)?</span><span class='regexp_end'>/</span></span>
  
  <span class='ivar'>@compressor</span>     <span class='op'>=</span> <span class='const'>Compressor</span><span class='period'>.</span><span class='id new'>new</span>
  <span class='ivar'>@force</span>          <span class='op'>=</span> <span class='kw'>false</span>
  <span class='ivar'>@package_names</span>  <span class='op'>=</span> <span class='kw'>nil</span>
  <span class='ivar'>@config</span> <span class='op'>=</span> <span class='lbrace'>{</span>
    <span class='symbol'>:css</span> <span class='op'>=&gt;</span> <span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id configuration'>configuration</span><span class='lbracket'>[</span><span class='symbol'>:stylesheets</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='comma'>,</span>
    <span class='symbol'>:js</span>  <span class='op'>=&gt;</span> <span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id configuration'>configuration</span><span class='lbracket'>[</span><span class='symbol'>:javascripts</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='rbrace'>}</span>
  <span class='ivar'>@packages</span> <span class='op'>=</span> <span class='lbrace'>{</span>
    <span class='symbol'>:css</span> <span class='op'>=&gt;</span> <span class='id create_packages'>create_packages</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='symbol'>:css</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span>
    <span class='symbol'>:js</span>  <span class='op'>=&gt;</span> <span class='id create_packages'>create_packages</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='symbol'>:js</span><span class='rbracket'>]</span><span class='rparen'>)</span>
  <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id="force=-instance_method"></span>
      <span id="force-instance_method"></span>
      <div class="method_details first">
  <p class="signature first" id="force-instance_method">
  
    - (<tt>Object</tt>) <strong>force</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Set force to false to allow packages to only be rebuilt when their source
files have changed since the last time their package was built.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


12
13
14</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 12</span>

<span class='kw'>def</span> <span class='id force'>force</span>
  <span class='ivar'>@force</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="package_names=-instance_method"></span>
      <span id="package_names-instance_method"></span>
      <div class="method_details ">
  <p class="signature " id="package_names-instance_method">
  
    - (<tt>Object</tt>) <strong>package_names</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Set force to false to allow packages to only be rebuilt when their source
files have changed since the last time their package was built.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


12
13
14</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 12</span>

<span class='kw'>def</span> <span class='id package_names'>package_names</span>
  <span class='ivar'>@package_names</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="cache-instance_method">
  
    - (<tt>Object</tt>) <strong>cache</strong>(package, extension, contents, output_dir, suffix = nil, mtime = nil) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Caches a single prebuilt asset package and gzips it at the highest
compression level. Ensures that the modification time of both both
variants is identical, for web server caching modules, as well as <span class="caps">MHTML</span>.</p>

  </div>
</div>
<div class="tags">
  
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="OutputNotWritable.html" title="Ram::OutputNotWritable (class)">OutputNotWritable</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


60
61
62
63
64
65
66
67
68
69
70
71
72</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 60</span>

<span class='kw'>def</span> <span class='id cache'>cache</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='comma'>,</span> <span class='id contents'>contents</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='comma'>,</span> <span class='id suffix'>suffix</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id mtime'>mtime</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='const'>FileUtils</span><span class='period'>.</span><span class='id mkdir_p'>mkdir_p</span><span class='lparen'>(</span><span class='id output_dir'>output_dir</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id exists?'>exists?</span><span class='lparen'>(</span><span class='id output_dir'>output_dir</span><span class='rparen'>)</span>
  <span class='id raise'>raise</span> <span class='const'>OutputNotWritable</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Ram doesn't have permission to write to \&quot;</span><span class='embexpr_beg'>#{</span><span class='id output_dir'>output_dir</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id writable?'>writable?</span><span class='lparen'>(</span><span class='id output_dir'>output_dir</span><span class='rparen'>)</span>
  <span class='id mtime'>mtime</span> <span class='op'>||=</span> <span class='id latest_mtime'>latest_mtime</span> <span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='period'>.</span><span class='id to_sym'>to_sym</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span>
  <span class='id files'>files</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
  <span class='id files'>files</span> <span class='op'>&lt;&lt;</span> <span class='id file_name'>file_name</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id output_dir'>output_dir</span><span class='comma'>,</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id filename'>filename</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='comma'>,</span> <span class='id suffix'>suffix</span><span class='rparen'>)</span><span class='rparen'>)</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='id file_name'>file_name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>wb+</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span> <span class='id f'>f</span><span class='period'>.</span><span class='id write'>write</span><span class='lparen'>(</span><span class='id contents'>contents</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
  <span class='kw'>if</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id gzip_assets'>gzip_assets</span>
    <span class='id files'>files</span> <span class='op'>&lt;&lt;</span> <span class='id zip_name'>zip_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id file_name'>file_name</span><span class='rbrace'>}</span><span class='tstring_content'>.gz</span><span class='tstring_end'>&quot;</span></span>
    <span class='const'>Zlib</span><span class='op'>::</span><span class='const'>GzipWriter</span><span class='period'>.</span><span class='id open'>open</span><span class='lparen'>(</span><span class='id zip_name'>zip_name</span><span class='comma'>,</span> <span class='const'>Zlib</span><span class='op'>::</span><span class='const'>BEST_COMPRESSION</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id f'>f</span><span class='op'>|</span> <span class='id f'>f</span><span class='period'>.</span><span class='id write'>write</span><span class='lparen'>(</span><span class='id contents'>contents</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
  <span class='kw'>end</span>
  <span class='const'>File</span><span class='period'>.</span><span class='id utime'>utime</span><span class='lparen'>(</span><span class='id mtime'>mtime</span><span class='comma'>,</span> <span class='id mtime'>mtime</span><span class='comma'>,</span> <span class='op'>*</span><span class='id files'>files</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="cacheable-instance_method">
  
    - (<tt>Object</tt>) <strong>cacheable</strong>(extension, output_dir)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Return a list of all of the packages that should be cached. If &#8220;force&#8221; is
true, this is all of them &#8212; otherwise only the packages that are missing
or whose source files have changed since the last package build.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 121</span>

<span class='kw'>def</span> <span class='id cacheable'>cacheable</span><span class='lparen'>(</span><span class='id extension'>extension</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='rparen'>)</span>
  <span class='id names'>names</span> <span class='op'>=</span> <span class='ivar'>@packages</span><span class='lbracket'>[</span><span class='id extension'>extension</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id keys'>keys</span>
  <span class='id names'>names</span> <span class='op'>=</span> <span class='id names'>names</span><span class='period'>.</span><span class='id select'>select</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id n'>n</span><span class='op'>|</span> <span class='ivar'>@package_names</span><span class='period'>.</span><span class='id include?'>include?</span> <span class='id n'>n</span> <span class='rbrace'>}</span> <span class='kw'>if</span> <span class='ivar'>@package_names</span>
  <span class='id config_mtime'>config_mtime</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id mtime'>mtime</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id config_path'>config_path</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='id names'>names</span> <span class='kw'>if</span> <span class='ivar'>@force</span>
  <span class='kw'>return</span> <span class='id names'>names</span><span class='period'>.</span><span class='id select'>select</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id name'>name</span><span class='op'>|</span>
    <span class='id pack'>pack</span>        <span class='op'>=</span> <span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span>
    <span class='id cached'>cached</span>      <span class='op'>=</span> <span class='lbracket'>[</span><span class='const'>Ram</span><span class='period'>.</span><span class='id filename'>filename</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span><span class='rbracket'>]</span>
    <span class='id cached'>cached</span><span class='period'>.</span><span class='id push'>push</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id filename'>filename</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='comma'>,</span> <span class='symbol'>:datauri</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id embed_assets'>embed_assets</span>
    <span class='id cached'>cached</span><span class='period'>.</span><span class='id push'>push</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id filename'>filename</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='comma'>,</span> <span class='symbol'>:mhtml</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id mhtml_enabled'>mhtml_enabled</span>
    <span class='id cached'>cached</span><span class='period'>.</span><span class='id map!'>map!</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id file'>file</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='id output_dir'>output_dir</span><span class='comma'>,</span> <span class='id file'>file</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
    <span class='kw'>if</span> <span class='id cached'>cached</span><span class='period'>.</span><span class='id any?'>any?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id file'>file</span><span class='op'>|</span> <span class='op'>!</span><span class='const'>File</span><span class='period'>.</span><span class='id exists?'>exists?</span><span class='lparen'>(</span><span class='id file'>file</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
      <span class='kw'>true</span>
    <span class='kw'>else</span>
      <span class='id since'>since</span> <span class='op'>=</span> <span class='id cached'>cached</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id file'>file</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id mtime'>mtime</span><span class='lparen'>(</span><span class='id file'>file</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id min'>min</span>
      <span class='id config_mtime'>config_mtime</span> <span class='op'>&gt;</span> <span class='id since'>since</span> <span class='op'>||</span> <span class='id pack'>pack</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id any?'>any?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id src'>src</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id mtime'>mtime</span><span class='lparen'>(</span><span class='id src'>src</span><span class='rparen'>)</span> <span class='op'>&gt;</span> <span class='id since'>since</span> <span class='rbrace'>}</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="create_packages-instance_method">
  
    - (<tt>Object</tt>) <strong>create_packages</strong>(config)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Compiles the list of assets that goes into each package. Runs an
ordered list of Dir.globs, taking the merged unique result.
If there are <span class="caps">JST</span> files in this package we need to add an extra
path for when package_assets is off (e.g. in a dev environment).
This package (e.g. /assets/package-name.jst) will never exist as
an actual file but will be dynamically generated by Ram on
every request.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 148</span>

<span class='kw'>def</span> <span class='id create_packages'>create_packages</span><span class='lparen'>(</span><span class='id config'>config</span><span class='rparen'>)</span>
  <span class='id packages'>packages</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='kw'>return</span> <span class='id packages'>packages</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id config'>config</span>
  <span class='id config'>config</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id globs'>globs</span><span class='op'>|</span>
    <span class='id globs'>globs</span>                  <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
    <span class='id packages'>packages</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span>         <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
    <span class='id paths'>paths</span>                  <span class='op'>=</span> <span class='id globs'>globs</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id uniq'>uniq</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id glob'>glob</span><span class='op'>|</span> <span class='id glob_files'>glob_files</span><span class='lparen'>(</span><span class='id glob'>glob</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id flatten'>flatten</span><span class='period'>.</span><span class='id uniq'>uniq</span>
    <span class='id packages'>packages</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id paths'>paths</span>
    <span class='kw'>if</span> <span class='op'>!</span><span class='id paths'>paths</span><span class='period'>.</span><span class='id grep'>grep</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id template_extension_matcher'>template_extension_matcher</span><span class='rparen'>)</span><span class='period'>.</span><span class='id empty?'>empty?</span>
      <span class='id packages'>packages</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:urls</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id grep'>grep</span><span class='lparen'>(</span><span class='const'>JS_EXTENSION</span><span class='rparen'>)</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id path'>path</span><span class='op'>|</span> <span class='id path'>path</span><span class='period'>.</span><span class='id sub'>sub</span><span class='lparen'>(</span><span class='ivar'>@path_to_url</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
      <span class='id packages'>packages</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:urls</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='lbracket'>[</span><span class='const'>Ram</span><span class='period'>.</span><span class='id asset_url'>asset_url</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id template_extension'>template_extension</span><span class='rparen'>)</span><span class='rbracket'>]</span>
    <span class='kw'>else</span>
      <span class='id packages'>packages</span><span class='lbracket'>[</span><span class='id name'>name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:urls</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id path'>path</span><span class='op'>|</span> <span class='id path'>path</span><span class='period'>.</span><span class='id sub'>sub</span><span class='lparen'>(</span><span class='ivar'>@path_to_url</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
  <span class='id packages'>packages</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="glob_files-instance_method">
  
    - (<tt>Object</tt>) <strong>glob_files</strong>(glob)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Absolute globs are absolute &#8212; relative globs are relative to ASSET_ROOT.
Print a warning if no files were found that match the glob.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


105
106
107
108
109
110</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 105</span>

<span class='kw'>def</span> <span class='id glob_files'>glob_files</span><span class='lparen'>(</span><span class='id glob'>glob</span><span class='rparen'>)</span>
  <span class='id absolute'>absolute</span> <span class='op'>=</span> <span class='const'>Pathname</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id glob'>glob</span><span class='rparen'>)</span><span class='period'>.</span><span class='id absolute?'>absolute?</span>
  <span class='id paths'>paths</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='id absolute'>absolute</span> <span class='op'>?</span> <span class='id glob'>glob</span> <span class='op'>:</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='const'>ASSET_ROOT</span><span class='comma'>,</span> <span class='id glob'>glob</span><span class='rparen'>)</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id sort'>sort</span>
  <span class='const'>Ram</span><span class='period'>.</span><span class='id warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No assets match '</span><span class='embexpr_beg'>#{</span><span class='id glob'>glob</span><span class='rbrace'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id paths'>paths</span><span class='period'>.</span><span class='id empty?'>empty?</span>
  <span class='id paths'>paths</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="individual_urls-instance_method">
  
    - (<tt>Object</tt>) <strong>individual_urls</strong>(package, extension) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Get the list of individual assets for a package.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


75
76
77</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 75</span>

<span class='kw'>def</span> <span class='id individual_urls'>individual_urls</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span>
  <span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:urls</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="latest_mtime-instance_method">
  
    - (<tt>Object</tt>) <strong>latest_mtime</strong>(paths)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Get the latest mtime of a list of files (plus the config path).</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


113
114
115
116</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 113</span>

<span class='kw'>def</span> <span class='id latest_mtime'>latest_mtime</span><span class='lparen'>(</span><span class='id paths'>paths</span><span class='rparen'>)</span>
  <span class='id paths'>paths</span> <span class='op'>+=</span> <span class='lbracket'>[</span><span class='const'>Ram</span><span class='period'>.</span><span class='id config_path'>config_path</span><span class='rbracket'>]</span>
  <span class='id paths'>paths</span><span class='period'>.</span><span class='id map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id p'>p</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id mtime'>mtime</span><span class='lparen'>(</span><span class='id p'>p</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id max'>max</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="not_found-instance_method">
  
    - (<tt>Object</tt>) <strong>not_found</strong>(package, extension)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Raise a PackageNotFound exception for missing packages&#8230;</p>

  </div>
</div>
<div class="tags">
  
<h3>Raises:</h3>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="PackageNotFound.html" title="Ram::PackageNotFound (class)">PackageNotFound</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


167
168
169</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 167</span>

<span class='kw'>def</span> <span class='id not_found'>not_found</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span>
  <span class='id raise'>raise</span> <span class='const'>PackageNotFound</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>assets.yml does not contain a \&quot;</span><span class='embexpr_beg'>#{</span><span class='id package'>package</span><span class='rbrace'>}</span><span class='tstring_content'>\&quot; </span><span class='embexpr_beg'>#{</span><span class='id extension'>extension</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id upcase'>upcase</span><span class='rbrace'>}</span><span class='tstring_content'> package</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="pack_javascripts-instance_method">
  
    - (<tt>Object</tt>) <strong>pack_javascripts</strong>(package) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Return the compressed contents of a javascript package.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


85
86
87</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 85</span>

<span class='kw'>def</span> <span class='id pack_javascripts'>pack_javascripts</span><span class='lparen'>(</span><span class='id package'>package</span><span class='rparen'>)</span>
  <span class='ivar'>@compressor</span><span class='period'>.</span><span class='id compress_js'>compress_js</span><span class='lparen'>(</span><span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='symbol'>:js</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="pack_stylesheets-instance_method">
  
    - (<tt>Object</tt>) <strong>pack_stylesheets</strong>(package, variant = nil, asset_url = nil) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Return the compressed contents of a stylesheet package.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


80
81
82</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 80</span>

<span class='kw'>def</span> <span class='id pack_stylesheets'>pack_stylesheets</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id asset_url'>asset_url</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='ivar'>@compressor</span><span class='period'>.</span><span class='id compress_css'>compress_css</span><span class='lparen'>(</span><span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='symbol'>:css</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id variant'>variant</span><span class='comma'>,</span> <span class='id asset_url'>asset_url</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="pack_templates-instance_method">
  
    - (<tt>Object</tt>) <strong>pack_templates</strong>(package) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Return the compiled contents of a <span class="caps">JST</span> package.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


90
91
92</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 90</span>

<span class='kw'>def</span> <span class='id pack_templates'>pack_templates</span><span class='lparen'>(</span><span class='id package'>package</span><span class='rparen'>)</span>
  <span class='ivar'>@compressor</span><span class='period'>.</span><span class='id compile_jst'>compile_jst</span><span class='lparen'>(</span><span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='symbol'>:js</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="package_for-instance_method">
  
    - (<tt>Object</tt>) <strong>package_for</strong>(package, extension)  <span class="extras">(private)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Look up a package asset list by name, raising an exception if the
package has gone missing.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


98
99
100
101</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 98</span>

<span class='kw'>def</span> <span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span>
  <span class='id pack'>pack</span> <span class='op'>=</span> <span class='ivar'>@packages</span><span class='lbracket'>[</span><span class='id extension'>extension</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@packages</span><span class='lbracket'>[</span><span class='id extension'>extension</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id package'>package</span><span class='rbracket'>]</span>
  <span class='id pack'>pack</span> <span class='op'>||</span> <span class='id not_found'>not_found</span><span class='lparen'>(</span><span class='id package'>package</span><span class='comma'>,</span> <span class='id extension'>extension</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="precache_all-instance_method">
  
    - (<tt>Object</tt>) <strong>precache_all</strong>(output_dir = nil, base_url = nil) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Ask the packager to precache all defined assets, along with their gzip&#8217;d
versions. In order to prebuild the <span class="caps">MHTML</span> stylesheets, we need to know the
base_url, because IE only supports <span class="caps">MHTML</span> with absolute references.
Unless forced, will only rebuild assets whose source files have been
changed since their last package build.</p>

  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/jammit/packager.rb', line 40</span>

<span class='kw'>def</span> <span class='id precache_all'>precache_all</span><span class='lparen'>(</span><span class='id output_dir'>output_dir</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id base_url'>base_url</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id output_dir'>output_dir</span> <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='const'>Ram</span><span class='period'>.</span><span class='id public_root'>public_root</span><span class='comma'>,</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id package_path'>package_path</span><span class='rparen'>)</span>
  <span class='id cacheable'>cacheable</span><span class='lparen'>(</span><span class='symbol'>:js</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='rparen'>)</span><span class='period'>.</span><span class='id each'>each</span>  <span class='lbrace'>{</span><span class='op'>|</span><span class='id p'>p</span><span class='op'>|</span> <span class='id cache'>cache</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>js</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>  <span class='id pack_javascripts'>pack_javascripts</span><span class='lparen'>(</span><span class='id p'>p</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
  <span class='id cacheable'>cacheable</span><span class='lparen'>(</span><span class='symbol'>:css</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='rparen'>)</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id p'>p</span><span class='op'>|</span>
    <span class='id cache'>cache</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>css</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id pack_stylesheets'>pack_stylesheets</span><span class='lparen'>(</span><span class='id p'>p</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='rparen'>)</span>
    <span class='kw'>if</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id embed_assets'>embed_assets</span>
      <span class='id cache'>cache</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>css</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id pack_stylesheets'>pack_stylesheets</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='symbol'>:datauri</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='comma'>,</span> <span class='symbol'>:datauri</span><span class='rparen'>)</span>
      <span class='kw'>if</span> <span class='const'>Ram</span><span class='period'>.</span><span class='id mhtml_enabled'>mhtml_enabled</span>
        <span class='id raise'>raise</span> <span class='const'>MissingConfiguration</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>A --base-url option is required in order to generate MHTML.</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id base_url'>base_url</span>
        <span class='id mtime'>mtime</span> <span class='op'>=</span> <span class='id latest_mtime'>latest_mtime</span> <span class='id package_for'>package_for</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='symbol'>:css</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='symbol'>:paths</span><span class='rbracket'>]</span>
        <span class='id asset_url'>asset_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id base_url'>base_url</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='const'>Ram</span><span class='period'>.</span><span class='id asset_url'>asset_url</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='symbol'>:css</span><span class='comma'>,</span> <span class='symbol'>:mhtml</span><span class='comma'>,</span> <span class='id mtime'>mtime</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
        <span class='id cache'>cache</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>css</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id pack_stylesheets'>pack_stylesheets</span><span class='lparen'>(</span><span class='id p'>p</span><span class='comma'>,</span> <span class='symbol'>:mhtml</span><span class='comma'>,</span> <span class='id asset_url'>asset_url</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id output_dir'>output_dir</span><span class='comma'>,</span> <span class='symbol'>:mhtml</span><span class='comma'>,</span> <span class='id mtime'>mtime</span><span class='rparen'>)</span>
      <span class='kw'>end</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Mon Oct 24 22:09:16 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.9.2).
</div>

  </body>
</html>